package com.preskool.service.impl;

import com.preskool.mapper.PersonalFeesMapper;
import com.preskool.po.PersonalFees;
import com.preskool.service.PersonalFeesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author swj
 * @Date 2021/1/7
 * @version1.0
 */
@Service
public class PersonalFeesServiceImpl implements PersonalFeesService {
    //注入mapper接口
    @Autowired(required = false)
    private PersonalFeesMapper personalFeesMapper;
    /**
     * 查询全部数据进行分页
     * @return
     */
    @Override
    public List<PersonalFees> findAllPf(Integer currentPage,Integer pageSize) {
        List<PersonalFees> fees = personalFeesMapper.selectAllPaging(currentPage,pageSize);
        return fees;
    }

    /**
     * 根据id查询单条数据
     * @param pid
     * @return
     */
    @Override
    public PersonalFees findOnePf(Integer pid) {
        PersonalFees one = personalFeesMapper.selectByPrimaryKey(pid);
        return one;
    }

    /**
     * 修改数据
     * @param personalFees
     * @return
     */
    @Override
    public int updatePf(PersonalFees personalFees) {
        int update = personalFeesMapper.updateByPrimaryKeySelective(personalFees);
        return update;
    }

    /**
     * 添加数据
     * @param personalFees
     * @return
     */
    @Override
    public int addPf(PersonalFees personalFees) {
        int add = personalFeesMapper.insertSelective(personalFees);
        return add;
    }

    /**
     * 删除数据
     * @param pid
     * @return
     */
    @Override
    public int delPf(Integer pid) {
        int del = personalFeesMapper.deleteByPrimaryKey(pid);
        return del;
    }
}
